package com.hw.paltfrom.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.hw.paltfrom.pojo.HwCommandWorkflow;
import com.hw.paltfrom.vo.MidScrSvWorkflowVo;
import com.hw.paltfrom.vo.MidScrZHDDWorkflowVo;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 刘哥
 * @since 2019-11-07
 */
@Component
public interface HwCommandWorkflowMapper extends BaseMapper<HwCommandWorkflow> {

    @Select("SELECT TOP 10 * ,(SELECT sup.F_Title FROM HW_Supervision sup WHERE cwf.OBJECT_ID = sup.F_SpvId)  svName FROM HW_Command_WorkFlow cwf WHERE WorkFlow_Type='JCDD' and WorkFlow_Code='01' ORDER BY CommandWorkFlow_DataTime DESC")
    List<MidScrSvWorkflowVo> queryMidScrCreatedSvWorkflow();

    @Select("SELECT TOP 10 * ,(SELECT sup.F_Title FROM HW_Supervision sup WHERE cwf.OBJECT_ID = sup.F_SpvId)  svName FROM HW_Command_WorkFlow cwf WHERE WorkFlow_Type='JCDD' and WorkFlow_Code != '01' and WorkFlow_Code != '07' ORDER BY CommandWorkFlow_DataTime DESC")
    List<MidScrSvWorkflowVo> queryMidScrUpdateSvWorkflow();


    @Select("SELECT TOP 10 * ,ct.Task_Content as taskName,oso.CPH as cph,oso.D_ZS as zs FROM HW_Command_WorkFlow cwf,HW_Command_Task ct,HW_Data_OverrunStation_Overweight oso WHERE WorkFlow_Module = '01' AND WorkFlow_Code = '01' AND cwf.OBJECT_ID = ct.Task_ID AND ct.F_Id = oso.F_Id ORDER BY CommandWorkFlow_DataTime DESC")
    List<MidScrZHDDWorkflowVo> queryMidScrCreatedZhddWorkflow();

    @Select("SELECT TOP 10 * ,ct.Task_Content as taskName,oso.CPH as cph,oso.D_ZS as zs FROM HW_Command_WorkFlow cwf,HW_Command_Task ct,HW_Data_OverrunStation_Overweight oso WHERE WorkFlow_Module = '01' AND WorkFlow_Code != '01' AND WorkFlow_Code != '07' AND cwf.OBJECT_ID = ct.Task_ID AND ct.F_Id = oso.F_Id ORDER BY CommandWorkFlow_DataTime DESC")
    List<MidScrZHDDWorkflowVo> queryMidScrUpdateZhddWorkflow();
}
